home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet bezpieczenstwa
/
mini Pentoo LiveCD 2006.1
/
mpentoo-2006.1.iso
/
livecd.squashfs
/
usr
/
lib
/
python2.4
/
site-packages
/
pygtk.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2006-01-20
|
2KB
|
61 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.4)
import fnmatch
import glob
import os
import sys
__all__ = [
'require']
_pygtk_dir_pat = 'gtk-[0-9].[0-9]'
_pygtk_required_version = None
def _get_available_versions():
versions = { }
for dir in sys.path:
if not dir:
dir = os.getcwd()
if not os.path.isdir(dir):
continue
if fnmatch.fnmatchcase(os.path.basename(dir), _pygtk_dir_pat):
continue
for filename in glob.glob(os.path.join(dir, _pygtk_dir_pat)):
pathname = os.path.join(dir, filename)
if not os.path.isdir(pathname):
continue
if not os.listdir(pathname):
continue
if not versions.has_key(filename[-3:]):
versions[filename[-3:]] = pathname
continue
return versions
def require(version):
global _pygtk_required_version
if _pygtk_required_version != None:
if not _pygtk_required_version == version:
raise AssertionError, 'a different version of gtk was already required'
return None
if not not sys.modules.has_key('gtk'):
raise AssertionError, 'pygtk.require() must be called before importing gtk'
versions = _get_available_versions()
if not versions.has_key(version):
raise AssertionError, "required version '%s' not found on system" % version
for dir in sys.path:
if fnmatch.fnmatchcase(os.path.basename(dir), _pygtk_dir_pat):
sys.path.remove(dir)
continue
sys.path.insert(0, versions[version])
_pygtk_required_version = version